export const code = `<script setup>
    import { code } from './code/case2.js';
    import * as echarts from 'echarts';
    import { onMounted } from 'vue';
    onMounted(() => {
        // 基于准备好的dom，初始化echarts实例
        const dom = document.getElementById('pie-case-2');
        const myChart = echarts.init(dom, 'dark', { renderer: 'svg' });

        // 绘制图表
        /** @type {echarts.EChartsOption} */
        const option = {
            title: { text: '饼图样式设置' },
            tooltip: {},
            // ★★★不再需要配置坐标轴
            series: [
                {
                    name: '进入来源',
                    type: 'pie',
                    radius: 50, // ★★★饼图的半径
                    // ★★★而是把数据名称和值都写在系列中
                    data: [
                        {
                            value: 335,
                            name: '直接访问',
                        },
                        {
                            value: 234,
                            name: '联盟广告',
                        },
                        {
                            value: 1548,
                            name: '搜索引擎',
                        },
                    ],
                },
            ],
        };
        myChart.setOption(option);
    });
</script>
`;
